package wsi.task.typedetector;

import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;

public class CountryDetector extends AbstractDetector {

	public CountryDetector() {
		super("wordnet_country_108544813");

		setPatterns(null);
	}

	@Override
	public double detect(List<String> values) {
		int succ = 0;

		String[] ss = Locale.getISOCountries();
		Set<String> countries = new HashSet<>();

		for (String s : ss)
			countries.add(s);

		for (String i : values) {

			if (countries.contains(i)) {
				succ++;
			}
		}

		return 1. * succ / values.size();
	}
}
